<template>
  <div class="dynamic">
    <!-- 顶部插槽 -->
    <slot name="waterfall-top"></slot>
    <div class="waterfall">
      <div class="fall-list" v-for="(item, index) in dataList" :key="index">
        <img :src="item.imgurl" alt="" />
        <!-- 内容插槽 -->
        <slot name="waterfall-info" v-bind:value="item"></slot>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
  props: {
    dataList: {
      type: Array,
    },
  },
  setup() {
    return {};
  },
});
</script>
<style lang="scss" scoped>
body {
  margin: 0;
  padding: 0;
}
.dynamic {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}
.box::-webkit-scrollbar {
  width: 0px;
  height: 0px;
}
.waterfall {
  width: 98vw;
  padding: 0 0.133333rem;
  box-sizing: border-box;
  margin: 0.266667rem auto;
  overflow: hidden;
}
.fall-list {
  min-width: 49%;
  max-width: 49%;
  margin-bottom: 0.133333rem;
  float: left;
  overflow: hidden;
  background: #fff;
  border-radius: 0.133333rem;
  box-shadow: 0px 0px 0.133333rem #ccc;
  position: relative;
  img {
    min-height: 2.666667rem;
    max-height: 6.933333rem;
    width: 100%;
    overflow: hidden;
    display: block;
  }
  p {
    font-size: 0.4rem;
    text-align: center;
  }
  &:nth-last-of-type(odd) {
    float: right;
  }
}
</style>